package net.xi.dmhome.Utils;

/**
 * @Author: jxhu
 * @Description: 预测功能工具类
 * @Date Created in 2021-04-05 15:46
 * @Modified By:
 */
public class ForeCastUtil {

    /* @Description: 计算年龄得分,@Param:  */
    public Integer countAge(Integer age){
        Integer score = 0;
        switch (age){
            case 20:
                score+=0;
                break;
            case 25:
                score+=4;
                break;
            case 35:
                score+=8;
                break;
            case 40:
                score+=11;
                break;
            case 45:
                score+=12;
                break;
            case 50:
                score+=13;
                break;
            case 55:
                score+=15;
                break;
            case 60:
                score+=16;
                break;
            case 65:
                score+=18;
                break;

        }
        return score;
    }

    /* @Description: 计算体质指数得分,@Param:  */
    public Integer CountBodyMass(Double weight,Double height){
        double index = weight/height;
        Integer score=0;
        if (index<22){
            score+=0;
        }else if (index>=22&&index<=23.9){
            score+=1;
        }else if (index>=24&&index<=29.9){
            score+=3;
        }else {
            score+=5;
        }
        return score;
    }

    /* @Description: 计算腰围和年龄得分,@Param:  */
    public Integer CountWaistLine(String sex,Integer waistline){
        Integer score = 0;
        if (sex=="男"){
            score+=2;
            switch (waistline){
                case 75:
                    score+=0;
                    break;
                case 79:
                    score+=3;
                    break;
                case 80:
                    score+=5;
                    break;
                case 85:
                    score+=7;
                    break;
                case 90:
                    score+=8;
                    break;
                case 95:
                    score+=10;
                    break;
            }
        }else if (sex=="女"){
            switch (waistline){
                case 70:
                    score+=0;
                    break;
                case 74:
                    score+=3;
                    break;
                case 79:
                    score+=5;
                    break;
                case 84:
                    score+=7;
                    break;
                case 89:
                    score+=8;
                    break;
                case 90:
                    score+=10;
                    break;
            }
        }
        return score;
    }

    /* @Description: 计算收缩压得分,@Param:  */
    public Integer CountSbp(Integer sbp){
        Integer score = 0;
        switch (sbp){
            case 110:
                score+=0;
                break;
            case 119:
                score+=1;
                break;
            case 129:
                score+=3;
                break;
            case 139:
                score+=6;
                break;
            case 149:
                score+=7;
                break;
            case 159:
                score+=8;
                break;
            case 160:
                score+=10;
                break;

        }
        return score;
    }

    public Integer countRelatives(Integer relatives){
        Integer score=0;
        switch (relatives){
            case 1:
                score+=6;
            case 0:
                score+=0;
        }
        return score;
    }

    public String Suggestion(Integer score){
        String suggest = null;
        if (score<25){
            suggest = "参加适当饮食活动，增强体质；合理安排饮食，生活起居有规律";
        }else if (score>=25){
            suggest = "可能患有糖尿病，建议去医院做口服葡萄糖耐量实验";
        }
        return suggest;
    }
}
